Instructions

Warning: Do not copy and paste any code I give out here. You MUST write them up. If you copy and paste code from here to your RStudio, you will receive errors.

In Chapter 13 we explored how to use “mashup” data to create a map and put additional data “on top of” the map. In this assignment, we will do that, but with one additional requirement to “zoom” into the region of the United States where the data is of interest.

First, read in the dataset crimeInSYR.csv (in the project’s data folder). The column show the type of crime, the address of the crime, the city of the crime, and the date of the crime. As you can guess from the title of the data file, the focus of the dataset is crimes around the Syracuse, NY area.

For this assignment, you need to create two different, but related, maps: A map with “points” for each of the crimes, and a “density map” showing the same information.

Install the “ggplot2” and “ggmap” packages as needed, and load the two packages in the setup code chunk below.


# Add your library below.
library(readxl)
## Warning: package 'readxl' was built under R version 4.1.2

Step 1 - A map with “points” for each of the crimes

Step 1.1 - Read the data

  1. Read in crimeInSYR.csv and save it as an object.
  2. Investigate the data structure.
# Write your code below.
crimeInSYR <- read_excel("data/crimeInSYR.xlsx")
View(crimeInSYR)

crimedf <- crimeInSYR

Step 1.2 - Clean the data

  1. Change the column names to (“type”, “address”, “city”, “date”)
  2. Combine the address column and city column together and store the values into a new column called address_complete

Step 1.3 - Get your Google API Key

  1. You need a Google API key for the next step, which uses the geocode() function. Google API requires you to register your credit card information.
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## tibble [231 x 4] (S3: tbl_df/tbl/data.frame)
##  $ Aggravated assault: chr [1:231] "Aggravated assault" "Burglary" "Burglary" "Larceny" ...
##  $ 800 block Avery Av: chr [1:231] "100 block Village Dr" "800 block Bear St" "200 block N Geddes St" "0 block Destiny Usa Dr" ...
##  $ Syracuse          : chr [1:231] "Syracuse" "Syracuse" "Syracuse" "Syracuse" ...
##  $ 42358             : POSIXct[1:231], format: "2015-12-20" "2015-12-20" ...
## Warning: package 'ggmap' was built under R version 4.1.2
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.1.2
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.

Step 1.4 - Get Latitudes and Longitudes

  1. Get latitudes and longitudes for all address in the crime dataset and store them in a new column using the geocode() function.
  2. Make sure the new dataframe includes lon and lat columns.
  3. Investigate the structure.

It should look like this at this point:

Step 1.4 Environment

# Write your code below.

crimedf$geocode <- geocode(crimedf$address_complete)
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Village+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Bear+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+N+Geddes+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=900+block+S+Townsend+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Parkside+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Butternut+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+N+Clinton+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5300+block+W+Genesee+St+Camillus&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+S+Collingwood+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1600+block+W+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5800+block+Mckinley+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=8500+block+Brewerton+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=7900+block+Brewerton+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=8000+block+Brewerton+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6500+block+Baptist+Way+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3400+block+Erie+Blvd+E+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Easterly+Ter+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Row+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Huntleigh+Av+Fayetteville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5000+block+W+Seneca+Tpke+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4700+block+Onondaga+Blvd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Erregger+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Dewitt+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Greenwood+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Woodbine+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Shonnard+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1900+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Mclennan+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Park+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3800+block+Route+31+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1800+block+W+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Robinson+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Thurber+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2000+block+Erie+Blvd+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1600+block+W+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+First+North+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Fineview+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Fitch+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1200+block+Milton+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=8500+block+Sumac+Dr+Baldwinsville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=8100+block+Thompson+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Row+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2800+block+Brewerton+Rd+Mattydale&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2800+block+Brewerton+Rd+Mattydale&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Herman+Dr+North+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Maplehurst+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Warner+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+W+Glen+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Warner+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1700+block+W+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Ackerman+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Dablon+Ct+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+South+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Rowland+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3700+block+Theodolite+Dr+Baldwinsville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6300+block+Fremont+Rd+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Herbert+St+North+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Fernwood+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Grant+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Intrepid+Ln+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1600+block+S+Geddes+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+W+Onondaga+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5300+block+W+Genesee+St+Camillus&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Homewood+Dr+Fayetteville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=8100+block+Saintsville+Rd+Kirkville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Old+Liverpool+Rd+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=900+block+Wolf+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2900+block+James+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1500+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Ainsley+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Stafford+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1000+block+Tyson+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+W+Ellis+St+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Lodi+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Grand+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3000+block+Meadowbriar+Ln+Baldwinsville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5600+block+Thompson+Rd+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Sunset+Dr+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4900+block+W+Taft+Rd+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Oswego+St+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Xavier+Cir+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Green+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Hier+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4100+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Seymour+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Marcellus+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2200+block+W+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Rider+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Hoffman+Rd+Tully&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Comstock+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6300+block+Fremont+Rd+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Beechwood+Av+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Herald+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4700+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Nottingham+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+W+Onondaga+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Ashworth+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Village+Blvd+N+Baldwinsville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Downing+Rd+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+First+North+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Lakeview+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Summerfield+Village+Ln+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6500+block+Thompson+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Ballantyne+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Cleveland+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3300+block+W+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Turtle+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6900+block+Route+80+Tully&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1600+block+Grant+Blvd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Ostrom+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+N+Geddes+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5900+block+E+Taft+Rd+North+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1500+block+Meadowbrook+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Ackerman+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3100+block+Olive+Dr+Baldwinsville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Row+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Remington+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1200+block+Harrison+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2000+block+Grant+Blvd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+N+Clinton+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Kensington+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Howard+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Sequoia+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Vine+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2600+block+Brewerton+Rd+Mattydale&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3500+block+James+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=900+block+Madison+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Rider+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Fay+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Row+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Row+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Ravenswood+Dr+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+S+Main+St+North+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Fay+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Markland+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+W+Seneca+Tpke+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+S+Crouse+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=900+block+Ackerman+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=900+block+Ackerman+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Kensington+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Butternut+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1600+block+Spring+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1500+block+Meadowbrook+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+Ackerman+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+Walnut+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Lafayette+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Charles+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5300+block+Bunker+Hill+Way+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+N+Edwards+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+S+Geddes+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5100+block+Highbridge+St+Fayetteville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Tulip+St+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+W+Division+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+Columbus+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Richmond+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5300+block+W+Genesee+St+Camillus&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Jamesville+Rd+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3100+block+Erie+Blvd+E+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Rowe+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=6400+block+Basile+Rowe+East+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5100+block+W+Taft+Rd+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Juanita+Dr+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Metropolitan+Park+Dr+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+W+Seneca+St+Manlius&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2300+block+Brewerton+Rd+Mattydale&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=300+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Lafayette+Rd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4300+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+First+North+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2500+block+Erie+Blvd+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Comstock+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5700+block+W+Pine+Grove+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Butternut+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1200+block+Almond+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+S+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5800+block+E+Taft+Rd+North+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Richmond+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Greenwood+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Judson+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+Court+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Redfield+Pl+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5800+block+State+Rt+31+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=5800+block+Glendora+Rd+Cicero&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4100+block+Route+31+Clay&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3700+block+Erie+Blvd+E+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4100+block+Medical+Center+Dr+Fayetteville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Long+Branch+Cir+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2500+block+Erie+Blvd+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4700+block+Onondaga+Blvd+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Destiny+Usa+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2600+block+Erie+Blvd+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+S+Clinton+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+Park+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2500+block+Erie+Blvd+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Erie+Blvd+W+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+E+Water+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1100+block+N+Salina+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Erie+Blvd+W+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1100+block+Milton+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Milburn+Dr+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Sabine+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+James+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=4500+block+W+Seneca+Tpke+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2900+block+E+Genesee+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Knaul+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=100+block+Park+Way+Camillus&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=500+block+Towne+Dr+Fayetteville&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3600+block+Redhead+Ter+Liverpool&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Garden+City+Dr+Mattydale&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=600+block+Florida+Rd+Mattydale&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Fay+Ln+Minoa&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1200+block+Highland+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=700+block+Ostrom+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=800+block+Ackerman+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=1100+block+Butternut+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=200+block+Lakeview+Av+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Presidential+Plaza+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=400+block+Butternut+St+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=0+block+Shove+Park+Dr+Camillus&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=3100+block+Erie+Blvd+E+DeWitt&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=2500+block+Erie+Blvd+E+Syracuse&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
str(crimedf)
## tibble [231 x 6] (S3: tbl_df/tbl/data.frame)
##  $ type            : chr [1:231] "Aggravated assault" "Burglary" "Burglary" "Larceny" ...
##  $ address         : chr [1:231] "100 block Village Dr" "800 block Bear St" "200 block N Geddes St" "0 block Destiny Usa Dr" ...
##  $ city            : chr [1:231] "Syracuse" "Syracuse" "Syracuse" "Syracuse" ...
##  $ date            : POSIXct[1:231], format: "2015-12-20" "2015-12-20" ...
##  $ address_complete: chr [1:231] "100 block Village Dr Syracuse" "800 block Bear St Syracuse" "200 block N Geddes St Syracuse" "0 block Destiny Usa Dr Syracuse" ...
##  $ geocode         : tibble [231 x 2] (S3: tbl_df/tbl/data.frame)
##   ..$ lon: num [1:231] -76.1 -76.2 -76.2 -76.2 -76.1 ...
##   ..$ lat: num [1:231] 43.1 43.1 43.1 43.1 43 ...

Step 1.5 - Create mapSimple object

Use the following code to create an object called mapSimple:

#get latitude and longtitude for syracuse university
syr <-geocode ("syracuse university, syracuse, ny")
syr

# obtain maps from multiple sources and zoom into the region around syracuse university
syr.map <-get_map(location=syr, zoom=11)

# generate map and sore it in "mapSimple"
mapSimple <- ggmap(syr.map)
# plot the map
mapSimple
# Write your code below.
syr <- geocode('syracuse university, syracuse, ny')
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=syracuse+university,+syracuse,+ny&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
syr
## # A tibble: 1 x 2
##     lon   lat
##   <dbl> <dbl>
## 1 -76.1  43.0
syr.map <-get_map(location=syr, zoom=11)
## Source : https://maps.googleapis.com/maps/api/staticmap?center=43.039153,-76.135116&zoom=11&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx-tNYSZlWaMI9she8PPHXynJtSqw7s
mapSimple <- ggmap(syr.map)
mapSimple

Step 1.6 - Create crimemape

Create an object called crimemap based on mapSimple, where each point represents one crime.

It should look like this:

Step 1.6 Map

# Write your code below.

crimemap <- mapSimple + geom_point(data=crimedf, aes(x=geocode$lon, y=geocode$lat), color="blue")
crimemap
## Warning: Removed 2 rows containing missing values (geom_point).


Step 2 - A “density map” showing the same information.

Use the geom_density2d() function. See the documentation as well as the ggplot cheatsheet to acquire more information on this.

The plot should look like this:

Step 2 Map

# Write your code below.

?geom_density2d
## starting httpd help server ... done
crimedensity <- mapSimple + geom_density2d(data=crimedf, aes(x=geocode$lon, y=geocode$lat), color="blue")
crimedensity
## Warning: Removed 2 rows containing non-finite values (stat_density2d).